﻿@model AddGroupMembersViewModel
@{
    ViewBag.Title = "Add group member to \"" + Model.Group.GroupName + "\"";
    int i = 0;
}
<h2>
    @ViewBag.Title</h2>
<div class="proggy-form-div">
    @using (Html.BeginForm())
    {
        @Html.ValidationSummary(false)
        @Html.HiddenFor(m=>m.Group.GroupId)
        @Html.HiddenFor(m=>m.Group.GroupName)
        <p>
            <input type="submit" value="Add selected" class="proggy-button-go" />
            | @Html.ActionLink("Cancel", "EditGroup", new { id = Model.Group.GroupId, success = 5 }, new { @class = "proggy-button-stop" })</p>
        foreach (var avail in Model.MembersAvailable)
        {
            // get name
            var nameStart = "MembersAvailable[" + (i++) + "].";

            //
        <p>
            @Html.CheckBox(nameStart + "Selected", avail.Selected) @avail.Name (@avail.Username)
            @Html.Hidden(nameStart + "Username", avail.Username)
            @Html.Hidden(nameStart + "Name", avail.Name)
        </p>
        }
        <p>
            <input type="submit" value="Add selected" class="proggy-button-go" />
            | @Html.ActionLink("Cancel", "Groups", new { id = Model.Group.GroupId, success=5 }, new { @class = "proggy-button-stop" })</p>
    }
</div>
